import React, { Component } from 'react'
import PubSub from 'pubsub-js';

export default class Search extends Component {
    render() {
        return (
            <div className="form">
                <input type="text" ref={el => this.s = el} /> &nbsp;<button onClick={this.search}>搜索</button>
            </div>
        )
    }

    search = () => {
        //获取用户输入的关键字
        let v = this.s.value;
        //发送给 HeroList
        PubSub.publish('keywords', v);
    }
}
